package me.lovetcat.common.validate.validator;

import me.lovetcat.common.util.ValidDataUtil;
import me.lovetcat.common.validate.annotation.Mobile;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * @author acat on 2017-01-16 09:32
 */
public class MobileValidator implements ConstraintValidator<Mobile, String> {
    @Override
    public void initialize(Mobile constraintAnnotation) {}

    @Override
    public boolean isValid(String mobile, ConstraintValidatorContext context) {
        return ValidDataUtil.validMobile(mobile);
    }
}
